-
Notifications
You must be signed in to change notification settings - Fork 0
Swarm rework / dev merged #330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: development
Are you sure you want to change the base?
Conversation
Links to docs / API docs
link to API docs
doi fixes
The 3.23 petsc viewer for vtk is not recognised by pyvista. This is an alternative strategy that generates the unstructured mesh directly from dmplex. It is less general than the PETSc version in that it assumes the same element type everywhere (which is always true in uw3)
We changed the output in debugging / verbose mode and so one test was failing. It's not a great test because it just checks the output never changes. This will currently work but it is sensitive to the number of solvers instantiated during the test - should replace this with regular expression checking.
Simple functions to check if a point is within a simplex by computing barycentric coordinates. I'm using a different strategy at the moment, but these functions are worth keeping for when we need those coordinates.
Mostly a results of insisting that the `black` formatter gets run across the source before committing.
`black` formatter for this pyx file too
Add _ to some functions that do not need to be advertised
Adding a "BASIC_Swarm" type. Currently a clone of the standard (PIC) swarm but without any cell_id references. I keep the same (PETSc) field name for the coordinates as in the PIC swarm for compatibility. The swarm now has a `migrate` function which handles the communication using kdtree based redistribution and kdtree based checking of processor ownership Currently missing: an equivalent of the cell-by-cell `populate` method which would still be useful even in the absence of PIC functionality
Note: in PETSc 3.23.x, the PIC swarm interface has changed and it is no longer possible to access the CellID from petsc4py. Failing tests are now expected in standard swarms and nodal-point swarms. The goal is to make the BASIC swarm the default and use PIC only when necessary (never ?)
Not sure if I have caught all the interface changes, but the ones in the tests I have found / fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR integrates the latest dev updates and reworks key components including the new kdtree call/return pattern, solver interfaces, geometry utilities, and swarm management routines. Key changes include:
- Updating multiple test files and solver modules to accommodate new kdtree usage and uniform expression API.
- Adding a new geometry_tools module and revising dmplex creation functionality.
- Major modifications to swarm migration, rbf interpolation, and particle population methods.
Reviewed Changes
Copilot reviewed 61 out of 65 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/* | Updated tests to reflect new kdtree patterns and call/return interface |
| src/underworld3/visualisation.py | Renamed parameters and adjusted pyvista mesh generation routines |
| src/underworld3/utilities/geometry_tools.py | Introduced new geometry functions with modernized syntax |
| src/underworld3/utilities/create_dmplex_from_medit.py | Revised dmplex creation and labeling procedures for clarity and efficiency |
| src/underworld3/systems/* | Updated solver and ddt methods to use a unified expression API |
| src/underworld3/swarm.py | Enhanced swarm migration/population and rbf interpolation workflows |
Comments suppressed due to low confidence (1)
|
|
||
| coords = self.dm.getField("DMSwarmPIC_coor").reshape((-1, self.dim)) | ||
|
|
||
| coords[...] = ( |
Copilot
AI
Jun 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable 'all_local_cells' is referenced but not defined; ensure that this variable is computed or passed appropriately to avoid runtime errors.
|
@julesghub - this is the swarm rework branch with current dev back-propagated. The rework involves creating a (non-PIC) BASIC swarm type and the associated kd-tree based machinery for quickly determining which rank to allocate to which particle. Also, assuming that we pass up on the PETSc projection strategy (now in petsc4py), then we have little need for PIC anyway, so the BASIC swarm would be the base class for most of our other machinery (like read-write / adaptivity and semi-Lagrange advection). I am having a horrible time getting the tests to pass. This is partly due to using PETSc 3.23.x as there is some change in the compilers on the latest MacOS that I cannot get to work with previous versions of the PETSc repository. That means all PIC swarm tests fail. Unfortunately, all the read-write tests fail too and I don't know what I broke when trying to merge with the latest changes to the |
This branch has been merged with the dev updates (particularly the kdtree changes).
Copilot does not like the fact that the new kdtree implementation has a different call pattern / return pattern to the original and I am thoroughly in agreement after spending a lengthy time fixing all that stuff. I hope there are not notebooks that use kdtree out in the wild or they will get clobbered.
I'm running PETSc 3.23 so a number of PIC tests are broken.
Also, all the save/load and xdmf tests are failing. I am not sure how to fix those but will have a look.
L